﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.Unity;

namespace NCS.IConnect.Core.IoC
{
   internal static class TypeExtensions
    {
        public static  bool IsTypeOfUnity(this Type type)
        {
            string token1 = Encoding.Default.GetString(type.Assembly.GetName().GetPublicKeyToken());
            string token2 = Encoding.Default.GetString(typeof(IUnityContainer).Assembly.GetName().GetPublicKeyToken());
            return token1 == token2;
        }

        public static bool IsTypeOfEntLib(this Type type)
        {
            string token1 = Encoding.Default.GetString(type.Assembly.GetName().GetPublicKeyToken());
            string token2 = Encoding.Default.GetString(typeof(SerializableConfigurationSection).Assembly.GetName().GetPublicKeyToken());
            return token1 == token2;
        }
    }
}
